package com.xhwl.data.util;

import com.xhwl.common.annotation.View;
import com.xhwl.common.enums.OrganizationTypeEnum;
import com.xhwl.common.pojo.cent.sdata.Building;

import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Author: luyi
 * @Description:
 * @Date: Create in 16:30 2021/8/21
 */
public class SpaceUtil {

	public static List<com.xhwl.common.pojo.cent.sdata.Field> getSpaceFieldMap(OrganizationTypeEnum type){
		List<com.xhwl.common.pojo.cent.sdata.Field> result = new ArrayList<>();
		Field[] fields = type.clazz.getDeclaredFields();
		for (Field field : fields) {
			com.xhwl.common.pojo.cent.sdata.Field f = new com.xhwl.common.pojo.cent.sdata.Field();
			field.setAccessible(true);
			View view = field.getAnnotation(View.class);
			if(null == view){
				continue;
			}
			f.setCN(view.value());
			f.setEN(field.getName());
			result.add(f);
		}
		return result;
	}
}
